PEGetHandleString
Use PEGetHandleString to retrieve the text to which the string handle is pointing. The buffer will obtain the actual text. This function is used in conjunction with functions that return variable length strings. After your program allocates a buffer of sufficient size, this function moves the string from the string handle to the buffer.
C Syntax
BOOL CRPE_API PEGetHandleString (
HANDLE textHandle,
char FAR *buffer,
short bufferLength );
Parameters
textHandle
| Specifies the handle of the string containing the text of interest. This handle is obtained from a variable length string function.
|
buffer
| Specifies a pointer to the buffer into which you want the string copied.
|
bufferLength
| Specifies the length of the buffer in bytes, including the terminating null byte. This value should be identical to the length of the string obtained by the variable length string function.
|
Returns
- TRUE if the call is successful.
- FALSE if the call fails.
Remarks
- When you call the function that produces the string, it returns a length that includes a provision for the null byte at the end of the string. A buffer set to that length will hold the entire string including the terminating null byte.
- PEGetHandleString will copy, at most, the number of bytes indicated by bufferLength, ensuring that the string in the buffer is NULL-terminated.
- You can only use this call once with a given string handle because the string handle is discarded once the function is called. If you expect to use the string later, you will need to save it.
VB Syntax
Declare Function PEGetHandleString Lib "crpe32.dll" (ByVal textHandle _
As Long, ByVal Buffer As String, ByVal BufferLength As Integer) As
Integer
Delphi Syntax
function PEGetHandleString (
textHandle: HWnd;
buffer: PChar;
bufferLength: integer
): Bool stdcall;